package com.atguigu.d_constructor;

public class Teacher {

    private String name;
    private int age;

    //赠送的无参构造
    public Teacher(){
        System.out.println("Teacher的无参构造执行了,对象产生了 !");
    }

    //定义一个有参构造
    public Teacher(String name,int age){
        System.out.println("Teacher的有参构造执行了,对象产生了 !" );
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void show(){
        System.out.println(name + " --- " + age);
    }
}
